package com.ssm.dao;


import com.ssm.Entity.Dept;
import com.ssm.Entity.Emp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface EmpDAOImpl {

    @Select("select * from emp")
    List<Emp> selectEmp();

    @Select("select * from dept")
    List<Dept> selectDept();

    @Select("select * from emp where dept_id = #{deptId}")
    List<Emp> findEmpByDeptId(int deptId);

    @Insert("insert into emp(empId, emp_name, dept_id) values(#{empId}, #{empName}, #{deptId})")
    int addEmp(Emp emp);

    @Insert("insert into dept(deptId, deptName) values(#{deptId}, #{deptName})")
    int addDept(Dept dept);
}
